<template>
  <!-- 设置页面 -->
  <div>
    <van-nav-bar
      @click-left="onClickLeft"
      :border="false"
      title="设置"
      left-arrow
    ></van-nav-bar>
    <van-cell-group style="margin: 10px 0">
      <van-cell center title="个人设置" is-link to="/profile" />
    </van-cell-group>
    <van-cell-group style="margin: 10px 0">
      <van-cell center title="关于我们" is-link to="/about" />
      <van-cell center title="分享软件" is-link @click="showShare = true" />
      <van-share-sheet
        v-model="showShare"
        title="立即分享给好友"
        :options="options"
        @select="onSelect"
      />
      <van-cell center title="意见反馈" is-link to="/suggest" />
    </van-cell-group>
    <van-cell-group>
      <van-cell center title="服务条款" is-link to="/term" />
      <van-cell center title="隐私政策" is-link to="/policy" />
    </van-cell-group>
    <!-- 点击退出登录跳转到首页 -->
    <van-button
      block
      style="margin: 20px auto; width: 335px"
      type="warning"
      @click="Logout"
      size="large"
      >退出登录</van-button
    >
  </div>
</template>

<script>
import { Notify } from "vant";
export default {
  data() {
    return {
      showShare: false,
      options: [
        { name: "微信", icon: "wechat" },
        { name: "微博", icon: "weibo" },
        { name: "复制链接", icon: "link" },
        { name: "二维码", icon: "qrcode" },
      ],
    };
  },
  methods: {
    onSelect(option) {
      // Toast(option.name);
      this.showShare = false;
    },
    Logout() {
      Notify({ type: "success", message: "退出成功", duration: 1500 });
      // 修改session中userInfo的值
      this.$store.commit("userInfo", null);
      // 退出登录跳转到主页
      this.$router.push("/index");
    },
    onClickLeft() {
      return this.$router.go(-1);
    },
  },
};
</script>

<style scoped>
:deep(.van-nav-bar .van-icon) {
  color: #000;
}
</style>

<style lang="scss" scoped></style>
